package com.Activity;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.RectF;
import android.content.*;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;

public class PersonOverlay extends Overlay {
	
//	final static int picWidth = 20;
//	final static int picHeight = 34;
//	final static int arcR = 8;
	
	private String msg;
	
	private GeoPoint point;
	
	private Bitmap bmp;
	
	public PersonOverlay(GeoPoint p,String msg,Bitmap bmp){
		this.msg = msg;
		this.point = p;
		this.bmp = bmp;
	}
	
	public GeoPoint getGeoPoint(){
		return point;
	}
	
	public void setGeoPoint(GeoPoint p){
		this.point = p;
	}
	
	public String getMsg(){
		return msg;
	}
	
	@Override
	public boolean draw(Canvas canvas, MapView mapView, boolean shadow,long when){
		super.draw(canvas, mapView, shadow);
		Paint paint = new Paint();
		Point myScreenCoords = new Point();
		mapView.getProjection().toPixels(this.point, myScreenCoords);
		paint.setStrokeWidth(1);
		paint.setARGB(255, 0, 0, 0);
		paint.setStyle(Paint.Style.STROKE);
		paint.setTextSize(20);
		//canvas.drawBitmap(this.bmp, new Rect(0,0,34,34), new RectF(myScreenCoords.x-17,myScreenCoords.y-17,myScreenCoords.x+17,myScreenCoords.y+17), paint);
		canvas.drawBitmap(bmp, myScreenCoords.x, myScreenCoords.y, paint);
		canvas.drawText(this.msg, myScreenCoords.x, myScreenCoords.y, paint);
		return true;
	}
}
